import request from '../request'
import type { PageDto, PageResDto } from '../types'
import type { JobItemDto } from './type'
import globalData from '@/utils/globalVariable'

// 获取工作详情
export function getJobDetail(data: {
    jobId: number | string
    enterType: number | string
}) {
    return request.get(`${globalData.zpUrl}/api/v1/blue/zp/job/detail/pass`, data)
}

// 报名工作
export function applyJob(data: {
    jobId: number | string
    applyType: number | string
}) {
    return request.post(`${globalData.zpUrl}/api/v2/blue/zp/job/apply`, data)
}

/**
 * 获取职位薪资公司信息
 *
 * @param data 包含公司companyId的对象
 * @param data.companyId 公司ID
 * @returns 请求结果
 */
export function getJobPayCompany(data: {
    companyId: string
}) {
    return request.get(`${globalData.zpUrl}/api/v2/blue/zp/job/pay-company`, data) as Promise<any>
}

export function getJobList(data: Omit<PageDto, 'currentPage'>): Promise<PageResDto<JobItemDto>> {
    return request.get(`${globalData.zpUrl}/api/v2/blue/zp/job/list`, data)
}
